ce5baeed88e2608565e20e4b87a7ebfe970ff474,src/test/java/io/vertx/ext/shell/ShellServerTest.java,ShellServerTest,testSessionRemove,#TestContext#,317
Before Change
@Test
public void testSessionRemove(TestContext context) throws Exception {
CommandBuilder cmd = CommandBuilder.command("foo");
Async async = context.async();
cmd.processHandler(process -> {
Session session = process.session();
context.assertNotNull(session);
context.assertEquals("the_value", session.remove("the_key"));
process.end();
});
registry.registerCommand(cmd.build(vertx), context.asyncAssertSuccess(v -> {
Shell shell = server.createShell();
Job job = shell.createJob("foo");
Pty pty = Pty.create();
shell.session().put("the_key", "the_value");
job.setTty(pty.slave()).terminateHandler(status -> {
context.assertEquals(0, status);
context.assertNull(shell.session().get("the_key"));
async.complete();
}).run();
}));
}
@Test
After Change
@Test
public void testSessionRemove(TestContext context) throws Exception {
Async async = context.async();
commands.add(CommandBuilder.command("foo").processHandler(process -> {
Session session = process.session();
context.assertNotNull(session);
context.assertEquals("the_value", session.remove("the_key"));
process.end();
}).build(vertx));
Shell shell = server.createShell();
Job job = shell.createJob("foo");
Pty pty = Pty.create();
shell.session().put("the_key", "the_value");
job.setTty(pty.slave()).terminateHandler(status -> {
context.assertEquals(0, status);
context.assertNull(shell.session().get("the_key"));
async.complete();
}).run();
}
@Test